<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: 6LoWPAN over BLE (RFC7668)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__rfc7668if.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">6LoWPAN over BLE (RFC7668)<div class="ingroups"><a class="el" href="group__netifs.html">NETIFs</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaa5b1823c2509b8816ef98dcac67e037c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#gaa5b1823c2509b8816ef98dcac67e037c">ble_addr_to_eui64</a> (uint8_t *dst, const uint8_t *src, int public_addr)</td></tr>
<tr class="separator:gaa5b1823c2509b8816ef98dcac67e037c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3e245a85f9edddca93ddd2967209881d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#ga3e245a85f9edddca93ddd2967209881d">eui64_to_ble_addr</a> (uint8_t *dst, const uint8_t *src)</td></tr>
<tr class="separator:ga3e245a85f9edddca93ddd2967209881d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29dc0ebb8e640b64a57008b940fbca1e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#ga29dc0ebb8e640b64a57008b940fbca1e">rfc7668_set_context</a> (u8_t idx, const <a class="el" href="ip6__addr_8h.html#aaca9e796e93a355294c4954c08d01762">ip6_addr_t</a> *context)</td></tr>
<tr class="separator:ga29dc0ebb8e640b64a57008b940fbca1e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga22930ade4e77b3195fe59949834d85f0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#ga22930ade4e77b3195fe59949834d85f0">rfc7668_output</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>, struct <a class="el" href="structpbuf.html">pbuf</a> *q, const <a class="el" href="ip6__addr_8h.html#aaca9e796e93a355294c4954c08d01762">ip6_addr_t</a> *ip6addr)</td></tr>
<tr class="separator:ga22930ade4e77b3195fe59949834d85f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1d9d7aff9f2f0515f761be0802178197"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#ga1d9d7aff9f2f0515f761be0802178197">rfc7668_input</a> (struct <a class="el" href="structpbuf.html">pbuf</a> *p, struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga1d9d7aff9f2f0515f761be0802178197"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3d940376bd983c14ffcc8d2580f3bdde"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__rfc7668if.html#ga3d940376bd983c14ffcc8d2580f3bdde">rfc7668_if_init</a> (struct <a class="el" href="structnetif.html">netif</a> *<a class="el" href="structnetif.html">netif</a>)</td></tr>
<tr class="separator:ga3d940376bd983c14ffcc8d2580f3bdde"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This file implements a RFC7668 implementation for 6LoWPAN over Bluetooth Low Energy. The specification is very similar to 6LoWPAN, so most of the code is re-used. Compared to 6LoWPAN, much functionality is already implemented in lower BLE layers (fragmenting, session management,...).</p>
<p>Usage:</p><ul>
<li>add this netif<ul>
<li>don't add IPv4 addresses (no IPv4 support in RFC7668), pass 'NULL','NULL','NULL'</li>
<li>use the BLE to EUI64 conversation util to create an IPv6 link-local address from the BLE MAC (<a class="el" href="group__rfc7668if.html#gaa5b1823c2509b8816ef98dcac67e037c">ble_addr_to_eui64</a>)</li>
<li>input function: <a class="el" href="group__rfc7668if.html#ga1d9d7aff9f2f0515f761be0802178197">rfc7668_input</a></li>
</ul>
</li>
<li>set the link output function, which transmits output data to an established L2CAP channel</li>
<li>If data arrives (HCI event "L2CAP_DATA_PACKET"):<ul>
<li>allocate a <a class="el" href="group__pbuf.html#ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba">PBUF_RAW</a> buffer</li>
<li>let the pbuf struct point to the incoming data or copy it to the buffer</li>
<li>call netif-&gt;input</li>
</ul>
</li>
</ul>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaa5b1823c2509b8816ef98dcac67e037c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa5b1823c2509b8816ef98dcac67e037c">&#9670;&nbsp;</a></span>ble_addr_to_eui64()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ble_addr_to_eui64 </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>public_addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>convert BT address to EUI64 addr</p>
<p>This method converts a Bluetooth MAC address to an EUI64 address, which is used within IPv6 communication</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>IPv6 destination space </td></tr>
    <tr><td class="paramname">src</td><td>BLE MAC address source </td></tr>
    <tr><td class="paramname">public_addr</td><td>If the LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS option is set, bit 0x02 will be set if param=0 (no public addr); cleared otherwise</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="lowpan6__opts_8h.html#af4a4d962af3439b111a8e72e5eeaccf8">LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS</a> </dd></dl>

</div>
</div>
<a id="ga3e245a85f9edddca93ddd2967209881d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3e245a85f9edddca93ddd2967209881d">&#9670;&nbsp;</a></span>eui64_to_ble_addr()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void eui64_to_ble_addr </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>src</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>convert EUI64 address to Bluetooth MAC addr</p>
<p>This method converts an EUI64 address to a Bluetooth MAC address,</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst</td><td>BLE MAC address destination </td></tr>
    <tr><td class="paramname">src</td><td>IPv6 source </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga3d940376bd983c14ffcc8d2580f3bdde"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3d940376bd983c14ffcc8d2580f3bdde">&#9670;&nbsp;</a></span>rfc7668_if_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> rfc7668_if_init </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initialize the netif</p>
<p>No flags are used (broadcast not possible, not ethernet, ...) The shortname for this netif is "BT"</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netif</td><td>the network interface to be initialized as RFC7668 netif</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK if everything went fine </dd></dl>

</div>
</div>
<a id="ga1d9d7aff9f2f0515f761be0802178197"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1d9d7aff9f2f0515f761be0802178197">&#9670;&nbsp;</a></span>rfc7668_input()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> rfc7668_input </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structpbuf.html">pbuf</a> *&#160;</td>
          <td class="paramname"><em>p</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Process a received raw payload from an L2CAP channel</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">p</td><td>the received packet, p-&gt;payload pointing to the IPv6 header (maybe compressed) </td></tr>
    <tr><td class="paramname">netif</td><td>the network interface on which the packet was received</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK if everything was fine </dd></dl>

</div>
</div>
<a id="ga22930ade4e77b3195fe59949834d85f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga22930ade4e77b3195fe59949834d85f0">&#9670;&nbsp;</a></span>rfc7668_output()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> rfc7668_output </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetif.html">netif</a> *&#160;</td>
          <td class="paramname"><em>netif</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structpbuf.html">pbuf</a> *&#160;</td>
          <td class="paramname"><em>q</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="ip6__addr_8h.html#aaca9e796e93a355294c4954c08d01762">ip6_addr_t</a> *&#160;</td>
          <td class="paramname"><em>ip6addr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Compress outgoing IPv6 packet and pass it on to netif-&gt;linkoutput</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">netif</td><td>The lwIP network interface which the IP packet will be sent on. </td></tr>
    <tr><td class="paramname">q</td><td>The <a class="el" href="structpbuf.html">pbuf(s)</a> containing the IP packet to be sent. </td></tr>
    <tr><td class="paramname">ip6addr</td><td>The IP address of the packet destination.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>See rfc7668_compress </dd></dl>

</div>
</div>
<a id="ga29dc0ebb8e640b64a57008b940fbca1e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga29dc0ebb8e640b64a57008b940fbca1e">&#9670;&nbsp;</a></span>rfc7668_set_context()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> rfc7668_set_context </td>
          <td>(</td>
          <td class="paramtype">u8_t&#160;</td>
          <td class="paramname"><em>idx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="ip6__addr_8h.html#aaca9e796e93a355294c4954c08d01762">ip6_addr_t</a> *&#160;</td>
          <td class="paramname"><em>context</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set context id IPv6 address</p>
<p>Store one IPv6 address to a given context id.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">idx</td><td>Context id </td></tr>
    <tr><td class="paramname">context</td><td>IPv6 addr for this context</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK (if everything is fine), ERR_ARG (if the context id is out of range), ERR_VAL (if contexts disabled) </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
